/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bff.slimserver.utils;

import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.swing.ImageIcon;

/**
 *
 * @author Bill
 */
public class Resources {

    public static enum LABEL_KEY {
        ACTION_SQUEEZE_HOME_NAME("ACTION_SQUEEZE_HOME_NAME"),
        ACTION_SQUEEZE_HOME_SHORT_DESC("ACTION_SQUEEZE_HOME_SHORT_DESC"),
        ERROR_PLAYER_TEXT("ERROR_PLAYER_TEXT"),
        ERROR_PLAYER_TITLE("ERROR_PLAYER_TITLE");
       
        private String key;

        LABEL_KEY(String key) {
            this.key = key;
        }

        public String getKey() {
            return this.key;
        }
    }

    private static final ResourceBundle bundle =
            ResourceBundle.getBundle("resources/slimserver/messages");

    /**
     * For internationalization
     * @param message
     * @return
     */
    public static String getMessage(LABEL_KEY key) {
        return bundle.getString(key.getKey());
    }

    public static String getMessage(LABEL_KEY key, Object[] params) {
        return MessageFormat.format(bundle.getString(key.getKey()), params);
    }

    public static enum ICON_KEY {
        ACTION_SQUEEZE_HOME("ICON_SQUEEZE_HOME");
        private ImageIcon icon;

        ICON_KEY(String key) {
            this.icon = new ImageIcon(ICON_KEY.class.getResource(getIconPath(key)));
        }

        public ImageIcon getIcon() {
            return icon;
        }
    }

    private static String getIconPath(String iconKey) {
        return bundle.getString(iconKey);
    }

    public static ImageIcon getIcon(ICON_KEY key) {
        return key.getIcon();
    }
}
